package Q7;

import java.util.Scanner;

public class Question7 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 输入段表
        String[] segmentInputs = scanner.nextLine().split(" ");
        int[][] segmentTable = new int[5][2]; // 段表，5个段，每个段有起始地址和段长

        for (int i = 0; i < 5; i++) {
            segmentTable[i][0] = Integer.parseInt(segmentInputs[i * 2]);     // 段起始地址
            segmentTable[i][1] = Integer.parseInt(segmentInputs[i * 2 + 1]); // 段长
        }

        // 输入逻辑地址
        String[] logicalAddressInputs = scanner.nextLine().split(" ");
        int segmentNumber = Integer.parseInt(logicalAddressInputs[0]); // 段号
        int offset = Integer.parseInt(logicalAddressInputs[1]);        // 段内位移

        // 判断是否发生中断
        if (segmentNumber < 0 || segmentNumber >= 5 || offset < 0 || offset >= segmentTable[segmentNumber][1]) {
            System.out.println("interrupt");
        } else {
            // 计算物理地址
            int physicalAddress = segmentTable[segmentNumber][0] + offset;
            System.out.println(physicalAddress);
        }

        scanner.close();
    }
}